package com.ds.common.exception;

/**
 * 业务异常
 *
 * @author fs
 */
public class BizException extends RuntimeException {

    private ErrorEnum errorEnum;

    public BizException(ErrorEnum errorEnum) {
        super(errorEnum.getMessage());
        this.errorEnum = errorEnum;
    }

    public BizException(String message, ErrorEnum errorEnum) {
        super(message);
        this.errorEnum = errorEnum;
    }

    public BizException(String message, Throwable cause, ErrorEnum errorEnum) {
        super(message, cause);
        this.errorEnum = errorEnum;
    }

    public BizException(Throwable cause, ErrorEnum errorEnum) {
        super(cause);
        this.errorEnum = errorEnum;
    }

    public BizException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, ErrorEnum errorEnum) {
        super(message, cause, enableSuppression, writableStackTrace);
        this.errorEnum = errorEnum;
    }

    public ErrorEnum getErrorCode() {
        return errorEnum;
    }

    public void setErrorCode(ErrorEnum errorEnum) {
        this.errorEnum = errorEnum;
    }
}
